This is basically a laser-beam alarm of the type much loved by Hollywood spies -- only smaller.
A laser diode module shining onto a phototransistor will keep it fully on as from the phototransistor's perspective it will be thoroughly dazzled by the laser.
Something like this should do the trick. Collector of the phototransistor to a digital input. Experiment!
The next step up is to use an IR receiver and a modulated IR beam which would be insensitive to ambient light. You could still use a laser for your beam but an IR emitter would be cheaper and you'd just need to enclose it in some kind of tube to "focus" the light it emits.
If you're looking for a ready-made product to get ideas from take a look at the Camera Axe