Many golf courses have boundaries within the course to protect golfers, etc. You can have out of bounds anywhere if the course is set up that way. Most of the time those are local rules and for USGA tournaments the out of bounds within the course are taken out, but not always. At St Andrews, I don't recall any boundries that exist within the interior of the course like #7.