Not when the defendant is guilty and the attorney knows it.
A defense that could reduce the defendant's sentence? Fine. A defense that works to return a "not guilty" verdict? No.