The phrase leading up to the comma is a modifying phrase. It's describing something that was developed for detecting air pollutants. When you open a sentence with a modifying phrase followed by a comma, the word after the comma should be whatever is being modified. Here, the thing that was developed for detecting air pollutants was
the technique, so that should be the word after the comma in answer B.
The key pattern here is the modifying phrase at the beginning. Many modifying phrases are participial phrases (phrases built around -ed, and -ing verb participles). Some examples:
Published in Chicago,____
Discovered in London,___
Hoping to influence voters,____
In each of these cases, the thing after the comma needs to be whatever is described before the comma. So, for practice, for each of the examples above, choose one of the two options below.
Published in Chicago,____ (the journalist... / the newspaper....)
Discovered in a lab at Imperial College in London,___ (Penicillin... / Alexander Fleming...)
Hoping to influence voters,____ (the politician gave an impassioned speech / an impassioned speech was given by the politition)
It's also worth noting that
if there were no comma, then grammatically you'd be right that 'having the ability' would refer to 'air polutants'. Then we'd be talking about a specific kind of air pollutant -- 'air pollutants having the ability to analyze compounds.' But there are two problems with this: 1) there
is a comma, so the 'having the ability' phrase is not restrictive and 2) it doesn't make sense for pollutants to analyze compounds. (meaning and logic are just as if not more important than grammar rules in SC.)