Rising atmospheric carbon dioxide (CO2) concentrations are causing additional CO2 to be absorbed by the oceans. Recent studies show that exposure to elevated CO2 causes olfactory impairment in reef fishes; however, the ecological consequences of this impairment are largely unknown. This study examined the effects of short-term exposure to elevated CO2 on habitat preferences of coral-dwelling gobies. Adult gobies collected from the reef at Lizard Island (Great Barrier Reef, Australia) were exposed for 4 days to ambient CO2 (440 $μ$atm) or elevated CO2 (880 $μ$atm). Habitat preferences were then tested in laboratory and field experiments at ambient conditions. In olfactory preference tests, Paragobiodon xanthosomus displayed a strong preference for odour cues of their sole host coral Seriatopora hystrix; however, this preference was absent in gobies exposed to elevated CO2. Habitat choice experiments conducted in the field showed that Gobiodon histrio placed on dead coral colonies located preferred live habitat within 24 h; however, gobies exposed to elevated CO2 associated with both preferred and non-preferred habitats in approximately equal frequency. Preferred habitats are known to confer fitness advantages to coral-dwelling gobies. Consequently, these results suggest that future elevated CO2 levels might affect the ability of habitat specialist fishes to select favourable habitats.