How to detect a signal if it is greater than VDD or smaller than 0?
Use three resistors- one to the input, one to GND and one to Vdd. Each can be equal in value, say 10K. The other end of all three goes to one junction.  

Now you will have the voltage at the junction &lt; 1/3  Vcc for Vin &lt; 0 and >2/3 Vdd for Vin > Vdd. 

So, three more resistors in series from Vdd to gnd to give you the two thresholds. Again, 10K is fine. 

And a dual comparator with open-collector output and a pullup resistor (another 10K maybe), eg. LM393 (check the common mode range for your particular Vdd). The outputs are connected together*. Which connection goes to inverting and which to non-inverting is left as an exercise. You may need an inverter afterward- output will be low for detected outside 0 to Vdd. 

If the voltage can go way outside the supply range, consider clamping it with diodes to keep the comparator input voltages reasonable (though many comparators will behave reasonably if one of the input voltages is within range). 

\$*\$ By convention this is called 'wired-or' (assuming that the signal is inverted) but it's really wired-and.