"The boy used to sleep outside the house."
Translation:Drengen plejede at sove uden for huset.
I think the difference is "uden for" is in relation to something else (think outside of) whereas "udenfor" is an adverb and has no real relation to anything else. This could also be said "The boy used to sleep outside of the house". Udenfor is used without an object in the sentence, for example "vi skal udenfor"
According to this very helpful PDF:
"Rule of Thumb is there is either one or three parts.
Either: Only an adverb (Gå udenfor)
Or: Preposition + Adverb + Object (Du skal gå uden for døren)"