It is a good question. there are indeed types of wood that are not suitable for tanks.
First rule of thumb is: If its fresh wood, its going to kill your fish
Make sure your wood is long dead and hard (not rotting). if it is recently dead then it still has all the saps etc in it which can be very toxic to fish.
also make sure the wood is hard (yes, im sure there is a naughty joke in there somewhere). If the wood is soft or crumbly then it is probably rotting which will do nasty things to your tank.
Also, steer clear of any of the faster growing woods such as pine. Because it grows so fast it is often not a dense which leads it to rotting faster. Also, it is generally high in Acid which can cause large pH changes in your tank.
Any of the slower, hard woods are good.
also, driftwood from the beach can be a nice looking wood but make sure you soak the pants off it before you put it in your tank as it can still have a lot of salt on it.
And regardless of which wood you go with, make sure you boil/sterilise it before it goes in otherwise you are asking for trouble.