I understand that the Catholic Church issues annulments under certain circumstances for some marriages. What are the specific circumstances necessary to qualify a marriage for an annulment? I'm wondering if some annulments are denied, leaving the couple to resort to divorce instead, and what circumstances might lead to that.
Members of the Catholic Church are required to marry in front of a priest (or deacon) (CCC 1630). If one of the parties is Catholic, but there is a serious reason why the marriage should be celebrated in front of a civil servant or a non-Catholic minister, a dispensation can be granted. If no dispensation was granted and the couple did not observe this law — the marriage is considered invalid. Because the nullity of the marriage is clear from the circumstances there is no need for a canonical process to issue a Declaration of Nullity. The correction of this invalidity requires the couple to exchange their consent according to canonical form (commonly called "having the marriage blessed").
If one of the parties were prohibited from marrying by a diriment impediment, the marriage is invalid. Because these impediments may not be known at all, the marriage is called a putative marriage if at least one of the parties married in good faith.
Diriment impediments include:
Being too young. The absolute minimum age is 16 for males, 14 for females, but episcopal conferences can set a higher limit
Antecedent and perpetual impotence (not to be confused with sterility)
Being already married
If one party is a Catholic and the other has not been baptized (unless a dispensation is granted)
The man was ordained to holy orders
Either party made a public perpetual vow of chastity in a religious institute
Abduction with the intent of marriage (known as raptus), is an impediment as long as the person remains in the kidnapper's power
Impediment of Crime, bringing about the death of one's own spouse or the spouse of another, with the intention of marriage
Close relationship by blood, called Consanguinity, even if the relationship is only by law
Close relationship by marriage, called Affinity
Some of these laws can be relaxed by a dispensation before the ceremony.
For example, Catherine of Aragon and Henry VIII of England received a dispensation from the impediment of affinity (Catherine had previously been married to Henry's brother Arthur, who died). Henry based his request for an annulment on the grounds that the dispensation had been improperly given in that his father, Henry VII, had pressured the Archbishop of Canterbury into granting the dispensation.
The correction of this invalidity after the marriage requires first that the impediment has ceased or has been dispensed, and then a "convalidation" can take place or a sanatio in radice can be granted to make the marriage valid.
Grounds for nullity
A marriage may be declared invalid because at least one of the two parties was not free to consent to the marriage or did not fully commit to the marriage.
Grounds for nullity include:
Simulation of consent; that is, the conscious and positive exclusion at consent by either or both of the contracting parties of one or all of the essential properties or "goods" of marriage: a) exclusivity of the marital relationship; b) the permanence of the marital bond; c) openness to offspring as the natural fruit of marriage (canon 1101§2)
Deliberate deceit about some personal quality that can objectively and gravely perturb conjugal life (canon 1098)
Conditional consent; the condition must concern the past or present (canon 1102)
Force or grave fear imposed on a person to obtain their consent (canon 1103)
A serious lack of the discretion of judgment at consent concerning the essential matrimonial rights and obligations to be given (canon 1095 n.2)
Psychic incapacity at consent to undertake the essential obligations of marriage (canon 1095 n.3). According to Canon 1095 a marriage can be declared null only when consent was given in the presence of some grave lack of discretionary judgment regarding the essential rights and obligations of marriage, or of some real incapacity to assume these essential obligations.
It should perhaps be emphasized that an annulment does not dissolve a marriage. It is, rather, an official declaration that what appeared to be a marriage was not, i.e., that there was never a valid marriage in the first place. Unfortunately, in recent decades, the grounds for annulments have been expanded to the point where I find it hard to take them seriously --- for example, the "carries an addictive problem with alcohol or drugs into the marriage" quoted by Jeremy in his answer. In principle, grounds for annulments are supposed to be reasons why the purported marriage could not be valid --- for example, if one party was already married to someone else, or if one or both parties were being forced to get married, or if they had conspired to murder the previous spouse of one of the parties. In other words, grounds for annulments are essentially the same as impediments to marriage.
Some of the circumstances that allow for annulment are:
"Psychological incapacity, absence of a proper intention to have children, be faithful, or remain together until death. Lack of judgement when married (young age, pressure, so on). One spouse carries an addictive problem with alcohol or drugs into the marriage. Perhaps a person, unfaithful during courtship, continues the infidelity after marrying. Marriage because of a pregnancy. If one of the marriage mates is violent." from Catholic Update & Friar Jacks
Some annulments can be denied if they are lacking enough reason to do so. For instance if the couple are fighting(not violently) a lot and want to be separated, that is not terms for an annulment. Marriage counseling would be recommended.
If the couple where to get divorced without the annulment, I presume, there would be spiritual consequences. Mark 10:11&12:
"He said to them: “Whoever divorces his wife and marries another commits adultery against her, 12 and if ever a woman after divorcing her husband marries another, she commits adultery.”
Without first dissolving the marriage, a new marriage would be considered adultery.