I don't think anyone mentioned that the US government went through the trouble of purchasing what is now southern Arizona from Mexico AFTER the Mexican-American War for the railway.
Also, the takeover of New Mexico was not a big problem for the Americans. I'm not sure if there was any Mexican garrison at all, and Americans were already traveling to Santa Fe along the Santa Fe trail for business. A detachment of cavalry rode down the trail from Fort Leavenworth and took over New Mexico without fighting.
Technically this scenario isn't ASB but it makes no sense at all given the realities of the 1840s and 1850s. Even if the cavalry does not show up in Santa Fe, the USA will just buy the place at either the treaty ending the war or at some later date. You can keep Santa Fe in Mexico, but they would either have to win the war or there be no war, in which case they keep California too.
The best I can think of is that California successfully revolts from Mexico and forms its own independent country well before 1847. There is no Mexican-American War. At some point later in the nineteenth century both California and Texas join the Union voluntarily. And the Americans are fine with the only rail connection to southern California being dependent on a line going across the High Sierras and then south. Maybe the POD is that oceanic shipping gets alot faster alot earlier while no one is interested in investing in trans-continental railways.