"She works in the marketing department."
Translation:Zij werkt in de marketingafdeling.
Yes, that is correct. You should write it as one word.
A lot of people make mistakes with this 'samenstelling' (composition) of words. I guess it's because of the growing influence of the English language.
But "marketing afdeling" shouldn't be accepted, because 'samenstelling' is one of the basic rules of Dutch writing.
You can find some useful information on 'samenstelling' on this Dutch website: https://onzetaal.nl/taaladvies/samenstelling