The association fallacy is a formal logical fallacy that asserts that properties of one thing must also be properties of another thing, if both things belong to the same group. For example, a fallacious arguer may claim that "bears are animals, and bears are dangerous; therefore your dog, who is also an animal, must be dangerous."
When it is an attempt to win favor by exploiting the audience's preexisting spite or disdain for something else, it is called guilt by association or an appeal to spite (Latin: argumentum ad odium). Guilt by association is similar to ad hominem arguments which attack the speaker rather than addressing the claims, but in this case the ill feeling is not created by the argument; it already exists.
Formal version
Using the language of set theory, the formal fallacy can be written as follows:
Premise: A is in set S1
Premise: A is in set S2
Premise: B is also...