We investigate to what degree local physical and chemical conditions are related to the evolutionary status of various objects in star-forming media. rho Oph A displays the entire sequence of low-mass star formation in a small volume of space. Using spectrophotometric line maps of H2, H2O, NH3, N2H+, O2, OI, CO, and CS, we examine the distribution of the atomic and molecular gas in this dense molecular core. The physical parameters of these species are derived, as are their relative abundances in rho Oph A. Using radiative transfer models, we examine the infall status of the cold dense cores from their resolved line profiles of the ground state lines of H2O and NH3, where for the latter no contamination from the VLA 1623 outflow is observed and line overlap of the hyperfine components is explicitly taken into account. The stratified structure of this photon dominated region (PDR), seen edge-on, is clearly displayed. Polycyclic aromatic hydrocarbons (PAHs) and OI are seen throughout the region around the exciting star S1. At the interface to the molecular core 0.05 pc away, atomic hydrogen is rapidly converted into H2, whereas OI protrudes further into the molecular core. This provides oxygen atoms for the gas-phase formation of O2 in the core SM1, where X(O2)~ 5.e-8. There, the ratio of the O2 to H2O abundance [X(H2O)~ 5.e-9] is significantly higher than unity. Away from the core, O2 experiences a dramatic decrease due to increasing H2O formation. Outside the molecular core, on the far side as seen from S1, the intense radiation from the 0.5 pc distant early B-type star HD147889 destroys the molecules. Towards the dark core SM1, the observed abundance ratio X(O2)/X(H2O)>1, which suggests that this object is extremely young, which would explain why O2 is such an elusive molecule outside the solar system.