Because your daughter is often demonstrating this behavior following being punished, I would consider the purpose of her behavior to be revenge... which most often follows a lost power struggle.
Preventing a win-lose outcome to power struggles can be an effective way to solve the problem.... and can be achieved by stating your bottom line, non-negotiable limit (your win) and then offering choices within that limit (child's win).
The root of all revengeful behavior is HURT...
So, when revengeful behavior does occur, an effective and helpful way to respond that will not escalate the situation or give the behavior a payoff would be to first acknowledge the child's feelings or perspective (because until this is acknowledged and resolved, the child will continue to express his/her feelings through revenge)... then communicate the limit.
"I can tell that you are upset and angry, but peeing on the carpet is unsanitary and is not an appropriate way to express your feelings....
Would you like to talk to me about how you feel about what happened?... Do you understand why I did that?... What do you think we could do next time?
AFTER addressing the hurt that caused the revengeful behavior, THEN you can deal with the way the child expressed the hurt.
Except from the book, "The Parents Toolshop".....
"... we can simply point out the emotional consequences of revengeful behavior...
'When people feel hurt, they often hurt back, which only creates more hurt and doesn't solve the problem'.
If children damage something, we can show them how to make amends.... If possible, we want to use Problem Solving to reach this agreement. If we tell them what they WILL do, we can start a new power struggle or revenge cycle. The trust level is still shaky, so we need to carefully choose our attitudes, words, or actions.... "
Hope this helps!
S.
PS - if you want to learn more about the Parents Toolshop resources (which I just quoted above) including FREE parenting teleseminars, and tele-classes in which you can engage in brainstorming/problem-solving sessions with the author and other participants check it out at... http://www.parentstoolshop.com
There is also a new, first time offered...
T.I.P.S. Tele-Class (for parents of children ages 1-18). 8-week Tues. evening series. 7-9 p.m. EDT + optional 1/2 hour FREE Brainstorming Bonus session each week!
* I mention this because I have worked with Jody to help ME to solve many parenting challenges that I have experienced and have felt SO thankful for the benefits of her guidance.... and I thought that perhaps, if you haven't found a solution that works, you may try bringing it to one of the brainstorming/ problem-solving sessions.
If you're interested,
To see the list of classes, dates, times, directions, links to flyers and on-line registration,
you can go to...
http://www.parentstoolshop.com/HTML/ClassRegister.htm
and to see program descriptions and schedules for all workshops (statewide CEU & foster parent), you can go to...
http://www.parentstoolshop.com/HTML/Schedules2.htm