Police are going to identify themselves before hand and not let someone be standing behind them before they act (at least any with training).
If you are that close to the person you ARE in immediate danger as is the cashier.
Hopefully I would have enough sense to be aware if there was anyone else that could be an accomplice. If there are others that are suspicious, I will make my decision
based on there location in relation to me. If I don't believe someone has the drop on me, I certainly have the drop on the BG in front of me and take the shot or 3 and
put my back against something and scan for others.