Illuminate an LED when a ground switch is open
simulate this circuit &ndash; Schematic created using CircuitLab

Figure 1. LED on when SW1 is open.

How it works:


When SW1 is opened up to 5 mA (24 V / 4k7) will flow through SOLN, R1 and D1. The circuit relies on the solenoid having a high holding current (say, > 20 mA) relative to the required LED current so that the LED current does not keep the solenoid on when SW1 is opened.
When SW1 is closed R1/D1 is shorted out and the LED will turn off.
When SW1 is opened the inductive spike which might damage D1 is shunted by D2.
If you wish to be more precise with the D1 current calculation then add in the DC resistance of SOLN to the current calculation for the LED.