Let's assume you are using the ideal_comfort skin.
In /ideal_comfort/customer/buttons/buy_now.tpl
Surround the button code with an if statement like this:
Code:
{if $product.price ne 0}
{include file="customer/buttons/button.tpl" button_title=$lng.lbl_buy_now_img|substitute:"AltImagesDir":$AltImagesDir tips_title=$lng.lbl_buy_now notitle=true additional_button_class=$additional_button_class|cat:' add-to-cart-button'}
{/if}