Prefixes
Nouns, adjectives, and verbs form new combined parts of speech using prefixes and suffixes. Most often they will be written conjoined, but some reserve the right to be used with a hyphen. This is definitely the case with the prefixes self-, all-, ex-(only with the meaning "former").
All-star match
All-time level
Economic self-determination
Ex-wife
Ex-minister, but to exchange, to expect
Prefixes co-, pre-, post-, anti-, re-, non-, usually do not require "-" after themselves and are used with it only to avoid cluttering of letters or confusion in meanings. In addition, in the British version, these prefixes are hyphenated, while in the American version, they are spelled consonantly.
Antibodies, but anti-corruption
Re-creation, but recreation
Suffixes
As for suffixes, free-, odd-, sometimes in-, up are written with "-".
Tax-free, duty-free
Twenty-odd
Check-in, but check in
Close-up, but close up.
Just here is a clear demonstration of how to avoid confusion in parts of speech.