Commerce cart form alter to do an availability check
I'm not sure what you're asking about quantity for, so I'm going to set that question aside and answer the broader question of confirming availability before purchase. In Drupal Commerce, the product pricing system serves a two-fold purpose:


Determine the price of a product for the current user.
Determine if the product is no longer purchasable.


While #1 is the most common use case, #2 even has some core representation: if you add a product to your cart and then disable that product as an administrator, the product will be removed from your cart thanks to a default product pricing rule that unsets the price of disabled products. We'll make this process more explicit in the next version of Drupal Commerce, but right now you should understand that if the unit price of a product line item is "unset" or set to a NULL (empty) value, the product will not be considered purchasable.

This will result in one of two behaviors:


For a product in the cart, it will be removed.
For an Add to Cart form, the Add to cart button will be changed to Product not available.


So, in your case, I'd just add a product pricing rule that performed the availability check. If the product is not available, the Add to Cart form will not allow the product to be purchased. If it was already in the cart, it would be removed, so you might use a separate rule to remove unavailable products from the cart and display a message informing the customer what happened. If they were on a checkout page, it would be user friendly to also send them back to the cart page.

Since I don't know how you're checking availability, I'll just add that if you can't do what you need through Rules directly, you can just whip up a simple custom condition to perform the check for ya. There should be plenty of examples in our code and elsewhere.