My textbook "chemistry by Julia" says the following
When it comes to expressing the molar mass of elements such as oxygen and hydrogen, we have to be careful to specify what form of the element we mean. For instance, the element oxygen exists predominantly as diatomic molecules (O2). Thus, if we say 1 mole of oxygen and by oxygen we mean O2, the molecular mass is $\pu{32.00 amu}$ and the molar mass is $\pu{32.00 g}$. If on the other hand we mean a mole of atomic oxygen ($\ce{O}$), then the molar mass is only $\pu{16.00 g}$, which is numerically equal to the atomic mass of $\ce{O}$ ($\pu{16.00 amu}$). You should be able to tell from the context which form of an element is intended.
and then it gives examples like the following: How many moles of oxygen react with 2 moles of hydrogen to produce water? here the book says it is $\ce{O2}$ which is true from the chemical equation.
another example says Air is approximately 21% oxygen. and the meaning of oxygen here is again $\ce{O2}$ which is easy to deduce since oxygen found in nature is mostly $\ce{O2}$.
The last example I could not tell why and here it is: Many organic compounds contain oxygen. the meaning here is $\ce{O}$ a single atom, but why? and how to tell from a certain context what oxygen means, whether $\ce{O}$ or $\ce{O2}$?