Oxygen is no confession of life. On a distant planet, a telescope might detect the gas and still be looking at a sterile world, because starlight and escaping hydrogen can leave oxygen behind without a single organism. The apparent signature would be real; its biological interpretation would not necessarily follow.
Water loss offers one route to this deception. When ultraviolet radiation splits water molecules through photolysis, light hydrogen can escape into space while oxygen remains, potentially accumulating in the atmosphere. A planet that has lost an ocean could wear the chemical residue of its catastrophe as a misleading sign of habitability. Carbon dioxide offers another route: ultraviolet light can break it apart, releasing oxygen atoms that may combine into oxygen gas under suitable atmospheric conditions. Carbon monoxide, a companion product, could help expose that process, although detecting it would be difficult.
Context matters more than a single gas. Spectroscopy can reveal how an atmosphere absorbs light, but interpreting those signals requires estimates of the planet's temperature, its star's radiation and the other gases present. Methane alongside oxygen could strengthen a case for biology because the two gases tend to react, though nonliving sources of methane must also be considered. None of this constitutes a discovery of extraterrestrial life. Against the dark, an oxygen signal remains a question written in light.