  We present a pilot survey of 21 lines of sight towards UCHII regions in the
H2CO 1-1 (6cm) and 2-2 (2cm) transitions, using the H2CO centimeter lines as a
molecular gas densitometer. Using Arecibo and Green Bank beam-matched
observations, we measure the density of 51 detected H2CO line pairs and present
upper limits on density for an additional 24 detected 1-1 lines. We analyze the
systematic uncertainties in the H2CO densitometer, achieving H2 density
measurements with accuracies ~ 0.1-0.3 dex. The densities measured are not
correlated with distance, implying that it is possible to make accurate density
measurements throughout the galaxy without a distance bias. We confirm that
ultracompact HII regions are associated with gas at densities n(H2)~10^5cm^-3.
The densities measured in line-of-sight molecular clouds suggest that they
consist of low volume filling factor (f~10^-2) gas at high (n(H2)>10^4cm^-3)
density, which is inconsistent with purely supersonic turbulence and requires
high-density clumping greater than typically observed in gravoturbulent
simulations. We observe complex line morphologies that indicate density
variations with velocity around UCHII regions, and we classify a subset of the
UCHII molecular envelopes as collapsing or expanding. We compare these
measurements to Bolocam Galactic Plane Survey 1.1mm observations, and note that
most UCHII regions have 1.1mm emission consisting of significant (5-70%)
free-free emission and are therefore not necessarily dominated by optically
thin dust emission. A comparison of our data with the Mangum et al. starburst
sample shows that the area filling factor of dense (n(H2)~10^5cm^-3) molecular
gas in typical starburst galaxies is <~0.01, but in extreme starburst galaxies
like Arp 220, is ~0.1, suggesting that Arp 220 is physically similar to an
oversized UCHII region.
