Just say you already committed to company B's offer. Any professional person should understand not being all wishy-washy by saying yes, then noflip-flopping, but maybe yes againand going back on your word.
It sounds like you decided to accept the offer, then informed your employer about it before sending the message of acceptance. You could have, and should have just sent the message of acceptance first. Remember, you're not asking for their permission.
You already informed them you got an offer before accepting it which was way more than you were obligated to do in the first place. Then you had a conversation and they made their decision. It's not like you went over their head or were even secretive about it. You told them what was up, they made their decision, and then you made your decision based on their decision.
It's like selling something. If you already agreed to sell something for a certain price, but then someone else comes along after and offers you a higher price, do you call the first person back and say "Sorry, I got a better offer so I'm not selling it to you anymore." You don't. Not if you're being professional about it.