There is an enormous variety of such devices, so the terminology varies depending on the particular usage, but here are some blanket terms:
Interlock
A mechanical device or system architecture which requires some external set of requirements to be met in order to continue operation. In the example you gave, the device which prevents the handle from turning with the sash open is the interlock. In this case, it is a safety interlock.
Source: I'm an aerospace engineer
A safety interlock can be a:
Behavior-shaping constraint
These constraints force the user to make the device safe, often by way of an interlock. For example, in manual transmissions, there is an interlock which requires the driver to depress the clutch petal before starting the vehicle. This system is a behavior-shaping constraint, since the driver soon learns the process, and instinctively makes the system safe.
https://en.wikipedia.org/wiki/Behavior-shaping_constraint
Poka-Yoke
Borrowed from Japanese, poka-yoke means "mistake-proofing" or "inadvertent error prevention". Specifically, it is a design wherein a system will bring the operator's attention to improper conditions. Thus, a poka-yoke doesn't actually prevent misuse like an interlock does, but instead relies on the operator to correct the condition.
For example: when keys are left in an automobile ignition, modern vehicles will make a persistent dinging sound when the driver door is open in an attempt to alert the driver, who might otherwise lock the keys in the vehicle.
This is in contrast to an interlock, which would instead prevent the doors from locking while the key is in the ignition.
https://en.wikipedia.org/wiki/Poka-yoke
Defensive-Design
This is the the general design principle which attempts to predict ways a device could be misused, and designing in a way which makes such misuse difficult or impossible.
https://en.wikipedia.org/wiki/Defensive_design