Yes you can discharge your taxes in Chapter 7 and Chapter 13 bankruptcy if you meet the following criteria:
1. If the return was due (including extensions) less than 3 years prior to filing;
2. The return was actually filed less than 3 years before filing;
3. Taxes were assessed within 240 days of the filing date, with exclusions for pending offers of compromise, and stays of proceedings.
Read Bankruptcy Code §§ 507 and 523 closely.
Drink a cup of coffee, and repeat. This section of the Code is pretty clear, once you go through it a few times!