How to detect if a sensor is connected to a digital input

I apologize for asking a maybe simple or even dumb question: between wich pins do I have to put the voltage divider?

I am a noobie in electronics, I'm way better in software;-(