Arguably, submarines are the greatest threat to a modern carrier battle group. Aircraft can be detected at long range using over the horizon RADAR and picket ships. Subs generally need to be located using SONAR, though magnetic anomaly detection can sometimes locate them as well.
Warm surface waters are separated from the chilly bulk of the ocean by a layer called the themocline. The fact that this layer reflects sound makes SONAR based detection across it highly challenging: especially when the contact is something as quiet as a modern hunter-killer submarine. It is possible to use active sonar (the pinging thing from movies), but the sound produced by such systems reveals your position to others for a distance ten times greater than the effective detection range of the device. It also horribly damages the ears of whales, especially when used at crazy amplitudes like 250 decibels.
One way to deal with the thermocline problem while still using undetectable passive SONAR is to use a towed variable depth sonar array. For a ship, that would be pulled along beneath the thermocline. For a sub, it would probably be deployed above the layer. Another approach is to exploit convergence zones. Because of the nature of water under pressure, sound gets reflected off the ocean floor and back to the surface at intervals of 61 km. Sounds originating in one place can thus be best detected at points forming concentric circles.
Problems with SONAR are much worse in shallow waters, where high levels of noise from animals, waves, and tide noise make passive SONAR pretty useless. As such, modern navies avoid such waters as much as possible and behave as though they have already been detected by enemy forces whenever forced to operate within them.