When it threatens the values of freedom
Every religion wants everyone to follow it's values. So before you say a religion should be banned for "threatening freedom" I would look at how much of a driving force Christianity has been in fighting against many civil rights movements.
Also, the act of banning a religion would in itself be a threat to freedom, as we (at least in the US) have a constitutional right to follow whatever religion we want
When it threatens the values of freedom and lives of a country and it's people and is an all around incompatible religion.
And what point do you determine that it's the religion, as opposed to a minority group of it's followers, that is the threat?
How do you specifically and objectively define "incompatible" in this context?
How would that even be possible? The government can't know what's in people's heads. At least until we all start wearing neural implants and the NSA gets in.
This is another thing to address. Even if there was a moral (and legal) reason to ban a religion, there's no feasible way to do so. You can make legislation to ban some specific practices (like polygamy, for example) but there's no way to ban a belief