How to prevent deleting a term if used?
I wrote an article tackling this problem.

In short, you have to use hook_form_alter on the form taxonomy_form_term and use the function taxonomy_select_nodes() to check if a node uses the term in question.

You can just copy the code from the article into your custom module (naming the 'mymodule_form_alter' accordingly to your module's name), flush the caches and that should do it.