If it were me, I would respond as if her comments were no more than inconsequential ideas.
"I can just leave home, I don't have to go with you"...
"oh, honey, I know that sounds exciting for you and we are leaving right now. If you want to leave home, let's make a plan for that when we get home so you can at least get your clothes packed up and think about what you want to take with you."
Calm, collected, "it ain't no thing" peaceful attitude from you. I'm sure you are going to get a big, open-mouthed stare if you call her on it by agreeing with her. Sense of humor, keeping it cheerful,you stay unruffled.
"I can walk home"
"yes, you can honey, but the police might have something to say about that. See, they don't like it when kids go off without their parents [don't say 'parents leave their kids' because it puts her back in the drivers seat, you are calling her bluff] so I thought I'd help you out with this one."
Sometimes, if you can agree to her statement without letting her do what she wants,it stops the argument. It does sound like she is either doing this as an attention-getting action or is certainly testing the waters.
Does this only happen when you are out and about? If that's the case, the next time your husband is at home and you have the chance not to take her with you, I'd seriously consider making a point of leaving her at home. If she wants to go, a short "you know, when I told you it was time to go, you were rude to me. I don't need that nonsense and so you can stay home." Short and sweet.
Another idea would be to have a clear 'currency' consequence (you know, we talk about a kid's "currency" on this site--- about how kids all have an Achilles heal, something they love to do/watch/play). When it's calm time, simply state "The last few times we've been out, when I have told you it was time to go home, you were very rude to me. I'm concerned that you are developing a bad habit of saying rude things, and so this stops now. Whenever we hear you threaten to leave or rude talk, you will lose time doing (currency item or activity) or (item) will go away for the rest of the day, or even the next day."
If the problem is also happening throughout the day at home, consider reversing it: have her 'earn' time with her special item/show by completing a day without rude remarks or sassing. You'll have to figure out what's going to be more effective for her(taking the item away or letting her earn it) , and you also have to let the sulking go while calling her on the threats/remarks. In short, don't pick on everything she says, but do be clear with her when she's crossing those lines.
<I do have to say, 'old school style', that if I had threatened my parents with leaving off by myself, they likely would have pulled out and driven around the block-- giving me just enough time to burst into tears and wish I'd never said anything before they came back and said "are you ready to go now?" I'm not recommending it, but the thought did cross my mind. >