In an English grammar book I found this sentence:
Sarah got a job in factory.
Is the absence of an article legitimate here?
I would say the correct usage would be: ... in a factory.
Am I correct?
You are correct (If using American english). "in a factory" should be the correct term.
Typically, you would use "in x" to denote an occupation. For example "Sarah got a job in landscaping" or "Sarah got a job in marketing".
Since you are indicating a generic location like a "factory", you need the "a". If factory was an occupation however, the statement in the book would be right.
You will hear the noun without article in certain contexts:
Our customers can shop online on in store.
and in store there would usually be spoken much as online is spoken, without the typical pause that occurs between words. in and store would be treated rather like syllables of the same word, and you might fight them hyphenated: in-store.
There the meaning is generic. The reference is not to a particular store, but to the mode of shopping.
Thus, under appropriate circumstances you could say in factory
Are these features added to the car by the dealership or in factory?
although at the factory would be more common. The reference there in either case (zero article or the) is not to a particular factory but to a generic factory, to how in the context of vehicle assembly and preparation the features get added.
As always, the choice of article reveals the speaker's thought. You would be far more likely to hear in factory from someone whose daily work involves manufacturing and distribution logistics than from someone whose only knowledge of factories is that they are large buildings often with smoke-stacks, where stuff gets made.