Use the try me program to determine what it reads when the sensor is on the table, and when it isabove the floor. I think it will read a higher value when the sensor is not on the table.
Now you want your program to check whether the sensorvalue of the lightsensor is above the limit you chose with the help of the try me program. When it does, that means the light sensor is off the table.
Now you'd better stop or reverse the motors
EDIT: For this to work, the sensor must be positioned in such a way, that it will be close to the surface of the table, and so that it will hover above the floor, before the robot falls off the table