Most people who come in to see me have heard that student loans can't be discharged in bankruptcy. That's not quite right. Student loans can be forgiven in bankruptcy, but it is hard to do so. The bankruptcy law says that, unlike other types of debts, student loans can only be forgiven if the borrower can show the judge that it would be an "undue hardship" to pay them back. Most judges have set a very high standard; usually the borrower has to be disabled or unable to work. Your lawyer is best able to tell you if your situation gives you a shot at discharge. If it does, you sue the student loan lender during your bankruptcy case (the lawsuit is called an "adversary proceeding") and have a hearing in front of a judge.
Most people won't be able to do this, and so in those cases, it makes sense to think about repayment plans. If you have federal student loans, it's a good idea to look into consolidation and income-based repayment plans.