I did do it like that originally but then it depended on the colour of the table and it could be easily fooled by a window on one side of the room. You can get round it with a bit of calibration but it's still a bit haphazard and environment dependent.
In the end I used 2 short range digital IR scanners pointed down, when they point off the end of the table they don't detect anything.