「時間」means time, but「空」means free/leisure/spare time. Correspondingly,「沒(有)時間」means don't have time, but「沒空」means don't have free/leisure/spare time.
While「時間」works in all situations,「空」does not; there are situations where using「空」gives a strange impression or makes little sense, such as
- 我沒空打工賺錢 - I don't have the free time to go to work to earn money
- 我的孩子沒空上學 - My children don't have the free time to go to school
In the above, by using「空」, there's a feeling that the task described is trivial or unimportant, which comes across as abnormal if the people around you would consider otherwise.
「沒空」is otherwise more colloquial than「沒時間」, which means that you should use the latter when presenting written work.
Further notes:
- 「空」here means spare or vacant, and by extension spare time, pronounced in the fourth tone. Air is not the correct interpretation (and is pronounced in the first tone), although it would be related to vacant in meaning.
- For「沒」vs.「沒有」, see What is the difference between 没有+V. and 没+V.?