Hi, B.,
I'm going to go against what everyone else has said, and I'm sure there will be a lot of eye rolling, :) but that's okay. I stand by my answer.
Both my children have imaginary friends (be it imaginary or real spirits - doesn't matter). My nine year old sometimes still talks to pretend friends, when he's imagining a story or play-acting. My six year old definitely still talks to her "babies" and a mix of other "friends" she has invented, 80% of the day.
And sometimes she does what your daughter does - she speaks disrespectfully to them after I've addressed her. So when she does, I just look straight into her eyes and ask, "Are you talking to ME?" And, of course, she immediately says no, she was talking to them. Because she already KNOWS she should not talk to me that way. And I remind her that it's a good thing she wasn't talking to me or she'd have lost a privilege.
But (even though I know it sometimes really IS directed at me) I don't get on her about how she talks to "them", because she's just expressing frustration, and I understand. She's feeling very independent, because she can do so much now, and to have to still listen to big people tell her what to do HAS to be frustrating. And your daughter probably feels the same way - especially since she's the big sister now, and probably helps you with the baby, and is feeling her independence. She's just expressing herself in a safe way. At least in her mind, it's safe. She figures she can pretend to be talking to someone else, so it's okay to say what she really feels toward you at that moment.
I say, let her continue to do it, as long as you've let her know by your look and your tone that you're aware what is going on, and she's not REALLY getting away with it. She will understand you're just being tolerant and understanding.....to a point. :)
And remember, this, too, shall pass. :)
Best of luck! J.