A defense attorney can believe their client is innocent of course. But as to the general rule, the idea is that the role of the defense attorney is a necessary counterweight to the power of the state. So, if the defense attorney does her job, and the state fails to gain a conviction, despite its resources and the assistance of law enforcement, then it is the state's failure and not the defense attorney. That covers sleeping. I know a lot of good people who are criminal defense attorneys; it just wasn't for me.
Also, you have to be careful what you know, to some degree, when you are a criminal defense attorney (ok any attorney :-D), due to the responsibility for candor to the court. For sake of everyone's sanity, I'll post the rule in the legal thread. Long story short, you can't offer evidence you know is false - you can't lie to the court. So, if you don't know it's not true, you can still do it.