We devote an entire section in our e-book Reduce Debt, Reduce Stress to the topic of using retirement funds to pay off debt. In many cases, we warn against it. I don't know enough about your situation to tell you what you should or shouldn't do, but I would encourage you to think twice about this strategy.
For one thing, by the time you cash out your IRA and pay the taxes and penalty for early withdrawal, you will probably find the your IRA money doesn't go as far as you had hoped. In addition, retirement funds are typically protected from creditors. So even in a worst-case scenario where you had to default or file for bankruptcy, your retirement money would be safe. And if that is all you have set aside for retirement at age 40, it's going to be extremely hard to catch up.
I would encourage you to read our e-book and explore all your options before you decide to cash out your retirement funds. If you do decide to go this route, you may want to consider it in conjunction with negotiating settlements on your debts so that you don't have to use up every penny of your savings to get out of debt.