At around 8pm on Wednesday August 18, the officers were responding to a call when they were shot at with what they believed to be an air weapon from the direction of the derelict buildings at the Hatfield Colliery waste ground, near Doncaster.
The marked police car was also struck by a pellet but nobody was injured.
Officers are keen to speak to anyone who may have witnessed the incident to help with their investigation.
Witnesses or anyone with information can contact BTP by texting 61016 or calling 0800 40 50 40 quoting reference number 500 of 18/08/21.
Hatfield Colliery closed in 2015. The British Transport Police have jurisdiction over railway land as the site is adjacent to the Doncaster to Scunthorpe line.
In 2013, the line was closed for six months after a major landslip caused by the colliery's old spoil heaps destroyed the track running through Hatfield.