Whether you can claim your child as a dependent, if your ex-spouse did not, is based on who the custodial parent is and whose qualifying child the child is determined to be for that year according to the IRS rules. The following information will help determine who can:
Per IRS Publication 17 Your Federal Income Tax, page 27:
Children of divorced or separated parents (or parents who live apart). In most cases, because of the residency test, a child of divorced or separated parents is the qualifying child of the custodial parent. However, the child will be treated as the qualifying child of the noncustodial parent if all four of the following statements are true.
Page 29:
CAUTION: If a child is treated as the qualifying child of the noncustodial parent under the rules for children of divorced or separated parents (or parents who live apart) described earlier, see Applying the tiebreaker rules to divorced or separated parents (or parents who live apart), later.
Page 31:
Applying the tiebreaker rules to divorced or separated parents or parents who live apart. If a child is treated as the qualifying child of the noncustodial parent under the rules described earlier for children of divorced or separated parents (or parents who live apart), only the noncustodial parent can claim the child as a dependent and the child tax credit or credit for other dependents for the child. However, only the custodial parent can claim the credit for child and dependent care expenses or the exclusion for dependent care benefits for the child, and only the custodial parent can treat the child as a dependent for the health coverage tax credit. Also, the noncustodial parent can't claim the child as a qualifying child for head of household filing status or the earned income credit. Instead, the custodial parent, if eligible, or other eligible person can claim the child as a qualifying child for those two benefits. If the child is the qualifying child of more than one person for these benefits, then the tiebreaker rules just explained determine whether the custodial parent or another eligible person can treat the child as a qualifying child.