you could use server validation for this, though it will only work on a detail page with only one add to cart button.
add a hidden form element to the add to cart button form, in the property inspector click the plus button next to initial value and set it to use the available quantity column
add server validation from validation toolkit, select numeric validation.
For the server variable, select the quantity box. in the numeric validation setting set the maximum number to:
<%= Request.Form("qtyAvail") %>
where qtyAvail is the name of the hidden form element.
you can then add a validation show if behavior to show the message when validation fails.