Bill Ramey has a nice post on the ad hominem fallacy. I once essayed an attempt to pin down the fallacy myself. I think the basic idea of that post was right, but I wouldn't put it now the way I did then.
Part of what has influenced me to adjust my views is reading David Hitchcock's lovely little paper, Why there is no argumentum ad hominem fallacy, which I highly recommend. I think his arugment is quite right: in the strictest sense, there is no such thing as an ad hominem fallacy. However, I think there is a good basis for talk about an 'ad hominem fallacy' in a looser sense of the term 'fallacy'. The reason is this.
The problem with informal logic as it is often taught is that it fails to distinguish strategies and tactics of reasoning from strategies and tactics of rhetoric or persuasion. Any communicated argument will tactically involve both reasoning and rhetoric; but the two cannot be simply conflated. You can use the same tactic of reasoning with a very different tactic of rhetoric, and vice versa. So we need to distinguish the two. The traditional understanding of ad hominem (as Hitchcock notes, 'traditional' here is not very old at all, but it does seem to have become ensconced) is that it is a fallacy of irrelevance. There are genuine fallacies of irrelevance, the most important of which is the ignoratio elenchi. In an ignoratio elenchi, or fallacy of wrong conclusion, an argument adduced in support of conclusion X does not support X at all but Y instead. Whately has an excellent example of such an argument, one that is both obviously fallacious, but also shows how easy it would be to commit the fallacy. Suppose you are arguing for the conclusion, "The poor ought to be relieved in such-and-such way (e.g., by passing this particular law)"; and to argue for this conclusion, you give an argument for the conclusion, "The poor ought to be relieved". You have committed an ignoratio elenchi; quite literally you are arguing for the wrong conclusion.
What I would like to suggest is that our label 'ad hominem fallacy' is actually a conflation of a tactical mistake in reasoning and a particular rhetorical tactic. The tactical mistake in reasoning is nothing other than the ignoratio elenchi itself; that is the fallacy being committed, if any, when people talk about an 'ad hominem fallacy'. What makes it ad hominem is, however, purely a matter of rhetorical tactic. Thus we can find this grain of truth in discussions of the ad hominem fallacy: it is really a mistake of reasoning committed while trying to persuade in a particular way. However, the two aspects are not to be conflated; the mistake of reasoning is a perfectly common one, and the tactic of persuasion is a perfectly common one, both of which can occur without the other; and we just call 'ad hominem' those cases in which they happen to overlap.
So I would suggest this definition of an ad hominem fallacy: it is an ignoratio elenchi in an argument that involves a rhetorical focus on the ethos, that is, the character or behavior, of a given person or set of people precisely for the purpose of drawing from someone a concession or commitment.
This definition has immense advantages over the earlier ones. For instance, it shows why we find ad hominem fallacies so difficult to characterize properly: we have been conflating two different domains of discourse which, while related, need to be clearly distinguished. It also shows why we classify ad hominem fallacies the way we do: they are fallacies of irrelevance, because they are cases of ignoratio elenchi. It further shows how to resolve a common puzzle about ad hominem arguments, namely, the fact that sometimes they seem fallacious and sometimes seem not merely OK but exactly the right sort of argument: there is an ad hominem rhetorical tactic that sometimes is put into effect with an ignoratio elenchi, and sometimes with a perfectly reasonable and relevant argument.
As with ad hominem, so with a whole host of other neatly named fallacies: ad baculum, ad misericordiam, ad verecundiam, etc. They are all the same fallacy; they are merely that fallacy as exemplified in different rhetorical approaches to persuasion.