Firstly, I need to say that's a really good question that Spanish learners ask often.
Well when you say in Spanish
¿Dónde tengo que dejar los documentos? you're actually asking a question: Where do I have to leave the documents?. It's an obligation.
Whereas, es imposible de saber it's an informative sentence, I mean, you're saying that It's impossible to know, without any reason.
So the main difference between
De is they are used depending the verbs and the context of the sentence. For example:
If say something that I have to do, let's say, my homeworks I'll say:
Tengo que hacer mis deberes (I have to do my homework)
But if I say something that's not an obligation; a normal sentence it will be, for example:
Las respuestas a mis deberes son imposibles de saber (It's impossible to know the answers to my homework)
As you can see, the
que element is mostly used to say something you have to do and the
de element is used for informative sentences. Hope it helped.