Actually it is not
quite right. It is true that plants take in carbon dioxide and give out oxygen and that we
breathe in oxygen and breathe out carbon dioxide.
However it is quite possible that there
was some oxygen in the atmosphere of the planet when the planet was young and before
plants developed.
Also oxygen does not only exist on the Earth. Even if we ignore all the
planets in the Universe that we do not know about oxygen has been detected in our Solar
System.
Admittedly there is not much but here are some figures that might interest
you:
Mars – atmosphere
Carbon dioxide 95.32%
Nitrogen 2.7%
Argon
1.6%
Carbon monoxide 0.07%
Oxygen 0.03%
Venus –
atmosphere
Carbon dioxide over 96%
Nitrogen 3%
Minute traces of oxygen,
sulphur dioxide, water vapour etc.
Whether or not a planet can "hang on" to its
atmosphere depends on the escape velocity of the planet.