It is unfortunate that we have so many negative prefixes and there are really very few rules. There are some, like il- before words beginning with 'l', but even these are not consistent. Francois is right- it's a question of listening, reading and learning.