When a photon is absorbed by an electron in an oxygen atom, it can only be absorbed if there is an available unoccupied energy level for the electron to transition to. If the photon lacks sufficient energy to promote the electron to a free orbital, it does not get absorbed at all. The electron's ability to discern the energy level of the photon is governed by the principles of quantum mechanics. In essence, if a transition is not possible due to energy constraints, the absorption process simply does not occur. This highlights the fundamental nature of quantum interactions in atomic systems.