Are you looking to prevent the transaction, or just warn? Unless you’ve turned on the “Allow Negative Stock” setting in “Stock Settings”, you shouldn’t be able to sell more than you have in inventory.
I’m not aware of any way out of the box to get a non-blocking warning. You could certainly do this with a server or client script, but you’d have to write the logic yourself.
if i am to turn off “allow negative stock”, is it possible to set a permission for some role that will be able to do transaction even if it will result in negative stock? - without scripting?