Well acktually...
CO2 poisoning and asphyxiation from lack of oxygen are two different mechanism you can die from in a cave.
The flame test only tests for the presence of oxygen (flame goes from normal -> elongates as more distance required to consume required amount of oxygen -> dims significantly -> goes out; as oxygen decreases)
You don't want to proceed any further as the flame gets too dim...
It is possible for CO2 to accumulated in cold, still and low places as CO2 is heavier than all the other MAJOR components of air. However, it is also possible to accumulate a lethal amount without displacing so much oxygen such that the flame test indicates it's dangerous to proceed (the amount of CO2 is required to kill a person is much smaller than the amount of oxygen that needs to be displaced before succumbing to asphyxiation). You can get away with surprising little oxygen (as evidence by people living in high altitudes such as the Tibetan Plateau), but you won't get away with replacing the same volume of O2 with CO2...
Then there's methane, which is the other major gaseous hazard in caves (also typically from rotting material, if not mining). You can definitely use a flame to test for methane, but canaries were preferred historically for some reason....