Use a control relay with the 12vdc on the coil side and 24vdc on the relay side. When 12vdc is present on the coil the 24vdc will make your input high. When 12vdc drops from the coil, it will open the relay and the input will go low.
I'm sure there is a more advanced way, but this is easy and cheap.