Rules Guy: Is it legal to mark your ball when it’s not on the green?

two golf balls next to each other on a green

What do the rules say about marking your ball when it's not on the green?

Getty Images