Hi nayone,
You can shield the references inside of quote marks, so they won't get REF'd when you copy and paste. It looks like this:
= SETF("ThePage!Layers.Visible",NOT("ThePage!Layers.Visible"))
= SETF("ThePage!Layers.Visible[2]",NOT("ThePage!Layers.Visible[2]"))
You'll notice that the GETREF is gone, and the cell reference is inside of quotes. Visio first tries to evaluate strings as something it understands (ie: numbers, formulas, etc.) If it doesn't understand, then it just leaves it as a string. You can use this to your advantage in this case.
Note: if your layers get re-created in a different order, your formulas will toggle the wrong layers.