First of all you have to be sure it is your ball then once you have identified it consider your options. Assuming that the ball is unplayable you have three options all under penalty of one stroke.
1. Play again from where you last played, i.e. stroke and distance
2. Drop a ball within 2 club lengths of the spot on the ground directly below where the ball is at rest in the tree/on the branch no nearer the hole or
3. Drop a ball back on a line with where the ball lay in the tree and the hole, with no limit as to how far back you can go.
You may substitute a ball if you cannot retrieve your original ball, however you must be able to identify it correctly otherwise your ball is lost. When a ball is lost or out of bounds your only option under the rules is to play another ball from where you last played under penalty of one stroke.