The only scenario I can imagine where underground habitats won't cut it is if we turn the Earth into another Venus. In that case the heat would eventually cook the underground habitats and kill everyone off. While global warming is by most accounts as bad or worse than the worst predictions thus far, we aren't quite to the absolute out of control greenhouse effect of Venus.
Additionally, if the Venus scenario became a possibility, then I would expect a WWII level effort (5-10 trillion dollars) in extracting CO2 from the atmosphere, convert to diamond and dump in the oceans.