All you really need is a simple pass-transistor switch, for example,
http://electronicdesign.com/article/analog-and-mixed-signal/sensor-signal-converter-outputs-both-npn-and-pnp-s
The NPN "output" isn't required for your app. I would add a 10K pullup-R between Vin [you'd use 12V there] and the PNP base, to ensure the PNP turns off when the NPN is off.