http://www.utu1904.com/files/Download/GCOR_6th_ed.pdf
A link to the latest edition of the GCOR, the General Code of Operating Rules.
Blue flag rule is rule 5.13, rather lengthy, but the short answer to your question is the blue flag, be it a hang tag on the control stand or a steel blue “flag “outside the locomotive must be attached to the locomotive in such a way as to be clearly visible to anyone on, in or around the locomotive.
Once flagged the locomotive may not be coupled into, nor may anything be uncoupled from it, except under very specific circumstances in servicing areas.
Only a member of the craft that applied the blue flag may remove it.
Tracks are blue flagged at both ends, nothing may be moved in those tracks, nothing added to them or removed.
Switches are lined away from blue flagged tracks, and locked out to prevent accidental movement into the tracks, the locks are different from the standard lock, only the car department have keys to these locks, T&E employees are forbidden to have a key, and forbidden to apply or remove these locks.
On my railroad, if a carman is going to work engine air on a track, (use the locomotive’s compressor to air up the cars and perform an initial terminal brake test) he hangs his “blue flag” ID on the control stand, after the engineer removes the reverser, opens the generator field and applies the independent (locomotive only) brake.
This blue ID looks a lot like a standard employee ID, complete with a photograph of the employee; the ID itself is blue and constitutes a flag.<