Under the IRS rules the custodial parent is the parent with whom the child lived for the greater part of the year. The other parent is the noncustodial parent.
The IRS will award dependency exemption to the custodial parent.
The custodial parent may release the claim to the noncustodial parent by signing the form 8332 - http://www.irs.gov/pub/irs-pdf/f8332.pdf - should be filed with the noncustodial parent's tax return. The non-custodial parent - you should obtain that form signed by the custodian parent for specified years.
Please refer to the IRS publication 504 - http://www.irs.gov/pub/irs-pdf/p504.pdf
If a child is treated as the qualifying child of the noncustodial parent under the special rule for divorced or separated parents, only the noncustodial parent can claim an exemption and the child tax credit for the child.
However, the noncustodial parent cannot claim the child for head of household filing status, the credit for child and dependent care expenses, the exclusion for dependent care benefits, and the earned income credit. Only the custodial parent (or other eligible taxpayer) can claim the child as a qualifying child for these four tax benefits.
If you both will claim the same child - your tax return will be rejected - and the only option you would have to file a joint tax return. The IRS will ask you to provide supporting documents that (1)child is related to you (2)child is lived with you.
After you provide acceptable documents - your claim of the dependent will be approved and refund will be issued.
Your ex-spouse will be asked to repay back the overpaid amount with penalties and interest.
Let me know if you need any help.