Context. The HF molecule has been proposed as a sensitive tracer of diffuse interstellar gas, while at higher densities its abundance could be influenced heavily by freeze-out onto dust grains. Aims. We investigate the spatial distribution of a collection of absorbing gas clouds, some associated with the dense, massive starforming core NGC 6334 I, and others with diffuse foreground clouds elsewhere along the line of sight. For the former category, we aim to study the dynamical properties of the clouds in order to assess their potential to feed the accreting protostellar cores. Methods. We use far-infrared spectral imaging from the Herschel SPIRE iFTS to construct a map of HF absorption at 243 µm in a 6 × 3 .5 region surrounding NGC 6334 I and I(N).Results. The combination of new mapping that is fully sampled spatially, but is spectrally unresolved with a previous, single-pointing, spectrally resolved HF signature yields a three-dimensional picture of absorbing gas clouds in the direction of NGC 6334. Toward core I, the HF equivalent width matches that of the spectrally resolved observation. At angular separations 20 from core I, the HF absorption becomes weaker, which is consistent with three of the seven components being associated with this dense star-forming envelope. Of the remaining four components, two disappear beyond ∼1 distance from the NGC 6334 filament, suggesting that these clouds are spatially associated with the star-forming complex. Our data also implies a lack of gas-phase HF in the envelope of core I(N). Using a simple description of adsorption onto and desorption from dust grain surfaces, we show that the overall lower temperature of the envelope of source I(N) is consistent with freeze-out of HF, while it remains in the gas phase in source I. Conclusions. We use the HF molecule as a tracer of column density in diffuse gas (n H ≈ 10 2 -10 3 cm −3 ), and find that it may uniquely trace a relatively low-density portion of the gas reservoir available for star formation that otherwise escapes detection. At higher densities prevailing in protostellar envelopes ( 10 4 cm −3 ), we find evidence of HF depletion from the gas phase under sufficiently cold conditions.