We used to have something similar in a previous workplace of mine. Doors were unlocked by touching an RFID badge to a reader and then entering a PIN. If you entered PIN+1 instead, everything worked as normal and a silent alarm was triggered.
The same place also had a security system for a critical data center room: Opening the door from the outside (i.e. entering) would increment a counter by one, opening it from the inside would decrement it. If the room, according to that counter, was supposed to be empty, any movement within would trigger the same silent alarm. The system worked safely up to the point where two people entered together, one of them left the room and the other one's badge had a temporary malfunction. We were quite impressed with how quickly a large assortment of police would show up, guns blazing and all ;-)