Adjacently, I really dislike the courtroom phrasing "Isn't it true?" that is sometimes depicted in legal dramas.
>"Do you not have X?"
In my head it sounds belligerent and accusatory. While the other form sounds polite.
This negative phrasing to induce a positive response, may be a Japan only thing?
"Do you not have bananas?" is like "is it true that there are no bananas?". Then if there are bananas, the host can gleefully surprise you with them and feel like they solved a problem for you. This is only if it's said in a constantly upwardly-shifting tone, though.
It can be said another way, same words different tone, which sounds more like "how perplexing, there's no bananas, let me just make sure I didn't miss them because I thought they should be here". The host usually backs their answer up with an explanation of why there are no bananas.
A third form exists where it does sound accusatory. Like "you should have bananas you piece of crap". Usually said in a huffy puffy I-dont-have-time-for-this tone.
Maybe it also helps that all the sentence markers that make a sentence polite, negative, interrogative all get added on to the end (to the verb) in japanese, which probably makes the construction slightly less awkward. In this case it may go something like motsu (to have) -> mochimasu (to have, polite) -> mochimasen (to not have, polite) -> mochimasenka (to not have, polite, interrogative).
I'm making a lot of assumptions here though, I don't know if this is anywhere close to correct.
I personally avoid this construction at all costs. When someone asks a negative question, I reply with "you're right" instead of "yes" to mean I agree with the negativity.
- Excuse me, do you not have any bread? - Sorry, this is a butcher's shop. We don't have any meat. The bakery is across the road. They're the shop that doesn't have any bread.
First, in shops people clearly ask for whether they have something.
It's super common for clothes and shoes stores to have more sizes in the back. I might ask the negative form when I think it's likely they don't have the size for a reason, e.g. if the same shirt in a different color is laid out in my size. "You don't have this one in XS (like that other one here)?"
In situations where you expect a product to be stocked right there in its usual place but it's not there it's natural to ask in the negative. Ex: bakery that usually has a full tray of croissants has an empty one / or none at all. If you can guess it it's also natural to ask specifically if they sold out.
In situations where it's not clear if a shop even has a certain product / size or if you cannot find one and you are looking, it's definitely not unexpected to ask positively. Ex: Asking whether a different option is available, or a different flavour than the one you see in front of you, or "do you have this particular vinyl from ...?" (it would be super odd to ask negatively in that last case).
Often actually both work and choosing the negative form IMO is harder to get right.
There isn't really an inappropriateness component, and frankly the clerk in your example either was rude or they simply said "if it's not on this shelf, we unfortunately don't have it". And to be honest, I don't see how their response would have been different if you had asked negatively.
Maybe if you said "You don't have this, right?" the clerk would have said "that's right", but in general, if you ask "do you have" vs. "do you not have" should almost always result in the same apology that unfortunately they don't.
I think there's a misunderstanding somewhere because in Japan "do you have X" and "do you not have X" would elicit the same response in the negative case (something like "I'm sorry, we're out of stock"). There's no reason for the speaker to say "no" either way.
I actually made this mistake, asking for a product directly instead of negatively, when I was in Tokyo. The clerk took me to the aisle and said, "If we had it, it'd be here." And there was no space for it. Took me a couple times to realize what had happened.