The IRS will not look or ask for a divorce decree and would not ask about a joint legal custody..
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.
Let me know if you need any help.
Unfortunately - while you may amend your past returns - you generally would not be able to receive any additional refunds for all returns due to statute of limitation.
The statute of limitation to claim a refund is three years from the time the tax return was due.
Thus - for 2006 tax year - the tax return was due on Apr 15, 2007 and statute of limitation will run out on Apr 15. 2010.
So you will able to claim additional refund on 2006 and later years only.