I believe there is no certain rule for these two prefixes on how or where to use them. It's just a matter of familiarizing the words.
invalid - unvalid ("invalid" is the right term for 'not valid')
intouchable - untouchable ("untouchable" to mean 'forbidden to touch')
incorrect - uncorrect ("incorrect" to mean not correct)
indo - undo ("undo" to mean 'to cancel')
you better check out other words with these kind of prefixes in your dictionary.
in addition, aside from these two prefixes to mean "not" or the reverse meaning of the root word, there are other 'negative' prefixes that can be used and I should say, there is a bit rule(s) in using them:
"im" (commonly used followed by a word starting with "p":
impotent
impolite
impeccable
"ir" (commonly used followed by a word starting with "r":
irregular
irrelevant
irreversible
irresistible
:)