Yes, of course. This was quite common.
— The Evening News, Detroit MI Michigan, July 4, 1901
'Last train robbery of Butch Cassidy & the Sundance Kid'
Sundance supposedly turned up again almost a year later in the town of Elko, Nevada. At midnight on April 3, 1899, Sundance, Harvey Logan, and George Currie, wearing masks, reportedly burst into the Club Saloon on Railroad Street while the bartender was counting the day’s receipts. […]
No sooner had the locomotive stopped than two masked men jumped into the engine compartment and ordered Jones and his fireman, Dietrick, to move the train up the tracks across the bridge. […]
— Thom Hatch: "The Last Outlaws. The Lives and Legens of Butch Cassidy and the Sundance Kid", New American Library: New York, 2013.
On Tuesday, November 3, 1908, the paymaster for the Aramayo, Franke & Company silver mine left the mine’s office in Tupiza, Bolivia for the corporate headquarters in Quechisla. The next day, the payroll caravan ran into two white-masked men armed with rifles and pistols. The two robbers demanded that the paymaster hand over the two mules carrying the payroll.
— Leonard John Lanier: "Did They Die With Their Boots On?", ecu.edu 06, 2017 (PDF)
That was less embarrassing than getting a train stopped and blasting its safe, only to discover that two successive charges of dynamite couldn’t dent it. They had a repeat performance with another train safe, also tougher than both them and their dynamite. During one of these abortive attempts, clever Al successfully knocked off his own mask.
— Robert Barr Smith and Laurence J. Yadon: "Oklahoma Scoundrels. History's most Notorious Outlaws, Bandits and Gansters" , The History Press: Charleston, 2016.
 After further discussion, during which time Haines carefully surveyed the premises, he took leave, promising to call again in a few days.
True to his word, late one night ten days later Haines and two other masked men armed with pistols, knives, and clubs, broke into Mulford’s house.
It looked as though the Morrises had embarked on a new and better life when around midnight on October 10, 1844, six masked men burst into his cabin and abducted Katherine, Martha, David, and James.
— Ken Lizzio: "Pirates of the Prarie. Outlaws and Vigilantes in America's Heartland", Guilford Press: Lanham, 2018.
On October 6, 1866, at 6:30 in the evening, an Ohio & Mississippi train left Seymour with three Reno Gang members aboard: John and Sim Reno, along with Frank Sparks. When the train was beyond the town, the three forced their way inside the express car. John poked a Navy Colt into messenger Elam Miller’s face and he surrendered his keys. The masked outlaws scooped up ten thousand dollars in gold coin and thirty-three dollars in bank notes from one small safe. When they tried to pry open a larger safe, they had no luck. […]
— Gerry and Janet Souter: "Guns of Outlaws. Weapons of the American Bad Man", Zenith Press: Mionneapolis, 2014.
Other newspaper headlines:
"Masked Robber terrorizes Town."
— Kingston Daily Freeman, Volume XXXVIII, Number 231, 16 July 1909
"Masked Bandits Hoold Up Train"
— Kingston Daily Freeman, Volume XLII, Number 20, 9 November 1912
Kentucky was famed for its fine women, excellent bourbon whiskey, and Thoroughbred racehorses, including the nineteenth-century champion Salvator, pictured on this circa 1910 postcard. But not to be ignored was the state’s reputation for violence and lawlessness. Note the pistol and the group of masked night riders on their way through a tobacco field. (Collage of “Kentucky’s Fame,” ca. 1910, Kramer Art Company Postcard Proofs, 1999PH10.46, Kentucky Historical Society.)
— Maryjean Wall: "How Kentucky Became Southern. A Tale of Outlaws, Horse Thieves, Gamblers, and Breeders", University Press of Kentucky: Lexington, 2010. (p94, gBooks)
Just the collage from a dictionary of Western 'personalities', all paragraph excerpts from different people:
This time he went to work with a flour-sack mask and a double-barreled shotgun, performing his first stage holdup on July 26, 1875, somewhere around Sonora, California. He pulled two more stage robberies that same year, the task apparently becoming so much fun …
The coroner’s jury exonerated the lawmen, and the outlaw was laid to rest on August 20, 1878. This time he did not wear his flour-sack mask.
He did not leave until January 19, 1896. On August 13, he and several confederates walked into the Montpelier, Idaho, bank, put on their masks, and robbed it. […]
When Ed’s neighbors decided they had enough, they picked an interesting night to take action. Cash’s wife was giving birth, and on hand was a doctor, plus a couple of local women, all of whom must have looked aghast on April 9, 1894, when seven masked men came knocking on the door. […]
The stage carried eight passengers and $26,000 in gold, but three masked men stopped it. During the resultant shootout, one passenger and a shotgun guard were slain. […]
 Six months later, on September 8, the Bisbee stage was held up by several masked men. City Marshal Virgil Earp and Deputies Wyatt and Morgan Earp arrested cowboys Pete Spence and Frank Stilwell. […]
William Fredericks was born in Germany and still had his heavy German accent when he showed up in California. In May 1890, masked and carrying a shotgun, he stopped a Mariposa County stage, found the strongbox empty, and got only a few pennies from the driver and one female passenger. […]
On January 7, 1882, Hume was a passenger aboard the “Sandy Bob” stage when masked highwayman stopped it halfway between Tombstone and Contention in Ari- zona Territory. Nine male travelers, including Hume, were highjacked at the point of a shotgun. He lost two fine revolvers and $70 in cash. […]
On June 22, 1877, at two o’clock in the morning, masked vigilantes caught four Notch-Cutters at a dance. The vigilantes rode away, leaving all four hanging from a tree limb. Things quieted down now for a while, but in 1883 the killings began again. […]
— Leon Claire Metz: "The Encyclopedia of Lawmen, Outlaws, and Gunfighters", Facts on File: New York, 2003.
And from 'Arizona's official historian':
The handkerchief was one of the most utilitarian articles a cowboy could have in his possession. It could be used as a mask to filter the dust when riding drag behind the cattle herd. It came in handy as a sling for broken arms or as a tourniquet. It made a good wash rag when needed and could filter dirty water for drinking. It was also great sunburn protection and good for weather all around. (I’ve worn a neckerchief as a mask while on horseback in northern Colorado when the wind chill was about 40 below.) And, if you got tired of working for wages, you could use one to mask your face while robbing a train or bank.
— Marshall Trimble ("is Arizona’s official historian"): "Why do almost all the Old West characters wear handkerchiefs around their necks in TV shows and movies?", Truewest — History of the American Frontier, July 1, 2005. (Hat tip to ocmment from David Hammen)