To a point it is. See a robots.txt tutorial. Rogue robots will not obey your robots.txt file, however.
Hence the OP enquiring about doing it via htaccess Good morning Smyrl has got a point in the sense that they may be faking User Agents (as oppose to not obeying robots policies), rendering even the htaccess method useless. Then you'd have to block by IP which is a never ending chase.
I had a project running called botspotter years ago. I was astounded at the number of bots that visited. I documented many but we're talking thousands and most checked out as legit. You need to balance the performance hit, the headaches of identifying bad bots etc on the harm they actually cause.
Have you ever heard about "http://www.kloth.net/internet/bottrap.php" Code (markup): ? Endless lists in .htaccess spell trouble in a shared hosting environment and are pretty ineffective. btw: sorry, but I can't use live links yet.
You can try NiceStat, it can track bots, ban bots using User Agent or IP. Many other features, try demo