Why not build one similar to an ultrasonic range finder?
The Tx unit sends a pulse which hits the opposite wall and the Rx unit receives the echo. You would sound the alarm if you didn't receive a return pulse, or the pulse came back too soon or the pulse came back too late.
If there is no wall to reflect off, then you would simply sound the alarm whenever you received a return echo from any distance. This would be easier to implement than the first example.