How about a good ping sensor and, since water may confuse the sensor, similar to what I said before, have something float on the water(where the sensor is pointing). Program it so that if the sensor says that the distance to the water is too close for more than a few seconds.