Can anyone tell me if zu is written together in the same word with the stem, as in 'zudenken' for example or if there should be a space between the two words?
It is written as a separate word:
Wir sind gekommen, um zu bleiben.
It is different however for separable verbs:
Es wäre leicht gewesen, das nachzulesen.