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 H_2_, H_2_O, NH_3_, N_2_H^+^, O_2_, 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 H_2_O and NH_3_, 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.05pc away, atomic hydrogen is rapidly converted into H_2_, whereas OI protrudes further into the molecular core. This provides oxygen atoms for the gas-phase formation of O_2_ in the core SM1, where X(O_2_)~5x10^-8^. There, the ratio of the O_2_ to H_2_O abundance [X(H_2_O)~5x10^-9^] is significantly higher than unity. Away from the core, O_2_ experiences a dramatic decrease due to increasing H_2_O formation. Outside the molecular core, on the far side as seen from S1, the intense radiation from the 0.5pc distant early B-type star HD147889 destroys the molecules. Towards the dark core SM1, the observed abundance ratio X(O_2_)/X(H_2_O)>1, which suggests that this object is extremely young, which would explain why O_2_ is such an elusive molecule outside the solar system.