For open url buttons, you can use a formula that is blank under certain conditions. The button will be disabled.
For scripting buttons, you can have the script detect the conditions and only proceed if the right conditions are met. You cannot prevent the script from running at all. The button will not look disabled.
For all other button actions, you cannot selectively disable them for some records.