We present Submillimeter Array observations of H2CO and N2H+ emission in the disks around the T Tauri star TW Hya and the Herbig Ae star HD 163296 at 2-6 resolution and discuss the distribution of these species with respect to CO freeze-out. The H2CO and N2H+ emission toward HD 163296 does not peak at the continuum emission center that marks the stellar position but is instead significantly offset. Using a previously developed model for the physical structure of this disk, we show that the H2CO observations are reproduced if H2CO is present predominantly in the cold outer disk regions. A model where H2CO is present only beyond the CO snow line (estimated at a radius of 160 AU) matches the observations well. We also show that the average H2CO excitation temperature, calculated from two transitions of H2CO observed in these two disks and a larger sample of disks around T Tauri stars in the DISCS (the Disk Imaging Survey of Chemistry with SMA) program, is consistent with the CO freeze-out temperature of 20 K. In addition, we show that N2H+ and H2CO line fluxes in disks are strongly correlated, indicative of co-formation of these species across the sample. Taken together, these results imply that H2CO and N2H+ are generally present in disks only at low temperatures where CO depletes onto grains, consistent with fast destruction of N2H+ by gas-phase CO, and in situ formation of H2CO through hydrogenation of CO ice. In this scenario H2CO, CH3OH and N2H+ emission in disks should appear as rings with the inner edge at the CO midplane snow line. This prediction can be tested directly using observations from ALMA with higher resolution and better sensitivity.