We present the detection of molecular oxygen with Odin toward the dense molecular core pOph A, which is part of a region of active star formation. The observed spectral line is the $(N_J=1_1-1_0)$ ground state transition of O2 at 119GHz ($\lambda$=2.5 mm). The line center is at the LSR velocity of a number of optically thin lines from other species in the region. The O2 line also has a very similar, narrow, line width. Within the $10^{\prime}$ beam, the line intensity is $\int\!T_{\rm A}\,{\rm d}v = 28$mK kms−1, which corresponds to $5\,\sigma$ of the rms noise. A standard LTE analysis results in an O2 abundance of $5 \times 10^{-8}$, with an uncertainty of at least a factor of two. We show that standard methods, however, do not apply in this case, as the coupling of the Odin beam to the source structure needs to be accounted for. Preliminary model results indicate O2 abundances to be higher by one order of magnitude than suggested by the standard case. This model predicts the 487GHz line of O2 to be easily detectable by the future Herschel-HIFI facility, but to be out of reach for observations on a shorter time scale with the Odin space observatory.