As others have said, you don't have to be falsely full of praise to a place you don't like working when giving notice. However, there's a way to do it without actually lying.
12 years ago, I left this horrendous privately-owned company. It is, hands down, the worst place I ever worked; there is no close second. I hated that place with a passion, and the management of that company had no qualms about outright telling the employees how valueless we were, never mind the many illegal practices of company management.
Still, when I left, I made sure to not do or say anything that they could spin as a negative:
1) I worked three 12-hr days in a row to try to tie up every loose end I could think of (no one else could do my job; they didn't have the training).
2) When asked why I was leaving, I just said it was time for me to move on (I made sure not to give specifics to one woman who asked because I could trust her about as far as I could throw her).
3) I also wrote an e-mail to everyone in my area thanking them for the valuable lessons I was taking with me and teaching me what kind of person I wanted to be. This last part is significant because what I really meant was, "I look at a lot of you who've been horrible to work with over the years and remind myself that this is exactly the kind of person I do not want to be to others."
See, I could give "praise" and leave on a positive note knowing that my praise had a different meaning but that when asked if I were rehireable, my former employer had no cause to say no. I couldn't wait until ten years had passed so I could drop them from my resume.