Purpose of a 1099-C
When a creditor writes off or cancels your debt, this results in something of a tax perk to the company because the Internal Revenue Service no longer considers this money as income to the creditor. The IRS doesn't want the potential for taxation of this money to go away, however, so it shifts the liability to you. When a creditor cancels debt you owe, this relieves you of responsibility for paying it, and because you don't have to repay the obligation, the money stays in your pocket. Therefore, the IRS takes the position that it's income to you. You have to claim it on your return and pay taxes on it. If the amount of forgiven debt exceeds $600, the creditor must send you a 1099-C form, indicating cancellation of the debt. The creditor sends a copy of the form to the IRS as well, so the IRS is aware of what happened.
Discharge of Debts
When your bankruptcy discharges a debt, that debt ceases to exist. Therefore, if you file for bankruptcy and receive a discharge of the debt that the creditor eventually forgives and sends you a 1099-C for, the creditor technically has nothing to cancel because the debt is already gone. Your bankruptcy discharge supersedes the 1099-C and relieves you of responsibility for claiming the money as income. It doesn't happen automatically, however. You have to alert the IRS that you filed for bankruptcy, so the creditor actually had nothing to cancel. You can do this by filing IRS Form 982 with your tax return.
Issues of Timing
The timing of your bankruptcy is critical because a discharge only applies to debts – you can't discharge income. If you file for bankruptcy after you receive a 1099-C, what you have at this juncture is income, not a debt that you want to get rid of. The debt went away when the creditor forgave it; at that point, it became income to you. Therefore, if you receive a 1099-C before you file for bankruptcy, your bankruptcy proceedings won't affect it and you must report the income on your tax return.
If a creditor cancels your debt before you file for bankruptcy, you may have one other option for avoiding claiming the debt as income. Although you can't include the debt in your bankruptcy proceeding, you can take the problem up with the IRS. The IRS makes an exception for paying taxes on 1099-C income if you're insolvent at the time the debt is cancelled -- you had more debts than the value of your total assets could cover. If you filed for bankruptcy, this may have been the case. This is a separate issue from your bankruptcy, however.