There are a number of different approaches to solving this problem:
- Distance Sensors
- Touch Sensor
- RFID Tags around the edge of the table (Or magnets)
- Camera (Using image processing, would be harder and the arduino would probably not be powerful enough for this)
With the distance sensor you will need to check whether it is a digital or analogue signal provided by the sensor. For the purpose of your 'cliff sensor' you would probably be fine with digital as you would be able to use the sensor as a toggle to detect when the distance is over a minimum distance.
If you are interested in analogue sensors to provide more information (such as distance from a wall) than just a toggle switch you will need to check what the range is on the device. The sharp sensor pictured in the answer above will provide you with a voltage, which you will have to convert into a distance (It has an inverse relationship with distance). You will require 3 sensors to cover the same range of distances that an ultrasonic sensor covers (e.g. SRF08 Ultrasonic Range Finder). Sharp GP2D120 Distance Measurement Sensor 4-30cm for short range, the Sharp GP2Y0A02YK Distance Measurement Sensor 20-150cm for medium range, and the Sharp GP2Y0A710K0F Distance Measurement Sensor 100-550cm for the long range sensor. I had issues with the ultrasonic sensor dropping to zero sporadically, so you would need to program a catch statement if this dropout is unacceptable in your application. The SRF08 Ultrasonic Range Finder was much easier to work with as it had been tuned by the manufacturer.