A shabby, mean fellow; a term said to be derived from a number of dirty, tattered roguish boys, who attended at the Horse Guards, and Parade in St. James’s Park, to black the boots and shoes of the soldiers, or to do any other dirty offices. These, from their constant attendance about the time of guard mounting, were nick-named the black-guards.
Definition taken from The 1811 Dictionary of the Vulgar Tongue, originally by Francis Grose.
See also the definition in Nathan Bailey's 1736 dictionary of canting and thieving slang.
Black Fly * Black JackNathan Bailey's 1736 Dictionary of canting and thieving slang
John S. Farmer's collection of canting songs and slang rhymes