But that doesn't make sense, since the same thing is true in A!
No, it isn’t; and identifying which of the two cases is true is precisely the key point to understanding when resonance can happen and when it cannot.
First and foremost: we usually draw in two dimensions to represent three-dimensional molecules. Obviously, this is inadequate and often we need some way of determining the three-dimensional orientation of the two-dimensional images we draw. This is especially problematic with lone pairs which we typically draw in four corners (like a square) but which can be in any of many different orientations.
A lone pair can be in a pure s, a pure p or a hybrid orbital. A pure s orbital cannot participate in resonance with other π-bonds. A pure p orbital can, if it has the correct orientation and a hybrid orbital can if it has both the correct orientation and a sufficiently good hybridisation. In most cases, it is only the orientation that truly matters.
To determine the type of orbital a lone pair is in, one needs to look at the other bonds (and lone pairs, if applicable) that this atom has formed with other atoms. For pyridine, this is relatively simple:
- there are two $\ce{C-N}$ σ bonds to neighbouring atoms of the six-membered ring; and
- there is one π bond which is part of the ring’s aromatic system.
The π bond in a non-metal must derive from a p-type orbital. That locks one of our orbitals in as p. The remaining two depend on the $\ce{C-N-C}$ bond angle which we can approximate as $120^\circ$ which in turn leads to the necessary conclusions that these two orbitals must be $\mathrm{sp^2}$ orbitals. If we have two $\mathrm{sp^2}$ orbitals, there must be a third one (the lone pair) and all three must be in the same plane. Furthermore, these three $\mathrm{sp^2}$ orbitals must be angled at $90^\circ$ to the p-type orbital participating in the π bonds. This last tidbit is the key: As these two orbitals ($\mathrm{sp^2}$ and p) cannot be made parallel, they cannot be part of the same π system and thus they cannot be flipped in resonance structures.
Acetate’s $\ce{C-O-}$ oxygen is very different. Before assuming anything about potential resonance or not, the only orbital that has to point somewhere is the $\ce{C-O}$ bond. This bond could be realised by either a pure p orbital or any $\mathrm{sp}^n$ hybrid orbital. Thereafter, we have no bond angles to work with so no information to lock in any of the other orbitals. What the set of orbitals with the lowest energy will be depends on the molecule’s overall symmetry and various considerations that are impossible to reproduce with pen and paper in an exam. Thus, the best course of action is to assume a completely unhybridised oxygen atom. (This assumption turns out to not be entirely correct if one runs the calculation, but it certainly suffices for our considerations!)
As we have only pure atomic orbitals, we have two orthogonal p-type orbitals which in turn are orthogonal to the $\ce{C-O}$ bond. Critically, due to the constraints on the carbon atom connecting the two oxygens (it forms a π bond and three σ bonds; thus it must be $\mathrm{sp^2+p}$), the $\ce{C=O}$ π bond will itself be orthogonal to the $\ce{C-O-}$ σ bond (as all of carbon’s σ bonds must be in the same plane) and assuming Euclidian geometry this means one of the lone pairs on oxygen must be parallel to the $\ce{C=O}$ π bond.
Long consideration, short result: we have a p-type lone pair on oxygen that is oriented in parallel to the $\ce{C=O}$ π bond; these can overlap in resonance and that is why you can shift do electron-pair flipping with that lone pair.
As an exercise, you might want to analyse the situation in furane ($\ce{C4H4O}$), a five-membered ring made up of oxygen and four $\ce{C-H}$ groups.