A player can decide that a ball is unplayable anywhere on the course except when the ball is in a water hazard. If you declare your ball unplayable and this includes a ball in a bunker, you have three options under the unplayable rule, Rule 28.
Under penalty of one stroke you may:
a) go back and play from where you played – stroke and distance
b) drop a ball within two club lengths of where the ball is lying, no nearer the hole. If the ball is in the middle of a big gorse bush this is unlikely to get you out of the bush (and you must measure from where the ball is lying not from the edge of the bush!) so your could choose your third option which is
c) drop a ball anywhere back behind where the ball is lying, in line with the hole and there is no limit as to how far back you can go on this line.
You do not have to retrieve the original ball if it is unsafe or too difficult to do so and you may drop another ball when proceeding under this rule.
You may declare a ball unplayable in a bunker and the first option is the same as anywhere else on the course, i.e. play again from where you played into the bunker. If you chose either of the other two options you must drop a ball in the bunker.
Remember you always have the option of going back from where you played under penalty of one stroke and this is often your best option. When you clearly do not have a shot think about all your options before you take a swipe at the ball because if you decide to ‘have a go’ and do not get the ball out of trouble then your option of going back to play under stroke and distance is gone. Use the rules to your advantage particularly when playing stroke play and in matches.