tl;dr: It should be possible for tidally locked planets to have magnetic fields under certain condiitions which are not all known at the moment.
Tidally locked planets and moons rotate.
Their rotation is slowed down until their rotation rate with respect to the distant stars is the same length as their orbital period around their primary.
So a tidally locked planet will make a 360 degree rotation with respect to the distant stars in the same period that it orbits 360 degrees around its star.
So one side of a tidally locked planet will always face toward it's star in eternal light and the other side will always face away from the star in eternal darkness.
But since the planet orbits around its star, the direction between the planet and its star will be constantly changing. So for one side to constantly face the star the planet has to be rotating.
So tidally locked planets do rotate.
Because lower mass K type stars and red dwarfs are very dim their habitable zones are very close to them and thus their orbital periods are very short compared to Earth's. Thus the rotation periods of tidally locked planets are very short compared to an Earth year.
Here is a link to Wikipedia's list of potentially habitable planets, planets which orbit within the habitable zone of their stars and thus can possibly be habitable if they fit other requirements for habitability:
https://en.wikipedia.org/wiki/List_of_potentially_habitable_exoplanets
According to that list, the potentially habitable planets orbiting class M stars in the habitable zones of those stars have orbital periods between 140.4 Earth days and 4.05 Earth days. Thus their rotation periods with respect to the distant stars and within their own inertial frames vary between 140.4 and 4.05 Earth days.
And some of the shorter orbital periods and thus rotation periods are just a few times as long as Earth's rotation period.
As far as I know the processes which generate planetary magnetic fields are not understood very well.
I have read that it is convection currents in the liquid outer cores of planets, instead of the rotation of the cores, which generates planetary magnetic fields. In that case the rotation rate of the planet might be irrelevant to the strength of the planet's magnetic field, if any.
I note that the planet Mercury was a weak magnetic field, and Ganymede, the largest moon of Jupiter has a magnetic field which interacts with the magnetosphere of Jupiter.
Mercury and Ganymede are much smaller than the Earth, which might be a factor in weakening their magnetic fields.
Ganymede has an orbital and thus rotation period or 7.154 Earth days. Mercury has a rotation period of 58.646 Earth Days.
So if faster rotation tends to make a stronger magnetic field, it is possible that a rotation rate of 7.154 or even 58.646 Earth days might be fast enough to generate a strong magnetic field.
But the primary influence on how fast a planet loses its atmosphere is probably its escape velocity. A rough rule of thumb is that if the ratio of the world's escape velocity divided by the average velocity of a gas in the exosphere of the planet's atmosphere is 1 or 2, the planet will lose most of that gas almost instantly, while if the ratio is as high as 6 the planet will hold on to that gas just about forever - billions or trillions of years.
Many other factors can speed up a planet's loss of gas, but the only factor that can help a planet retain a gas longer is replenishment of that gas as fast or faster than it is lost.
The planet Venus has an escape velocity of 10.36 kilometers per second, 0.926 of Earth's 11.186 kilometers per second. Venus is closer to the Sun, about 0.723332 as far as Earth is, and so the solar wind is stronger at Venus. Venus has no magnetic field to protect its atmosphere from being knocked away by the solar wind.
The rotation period of Venus is 243.0226 Earth days, which may or may not have anything to do with its lack of a magnetic field.
Venus has a dense atmosphere composed of 96.5% carbon dioxide, 3.5% nitrogen—both exist as supercritical fluids at the planet's surface—and traces of other gases including sulfur dioxide.[30] The mass of its atmosphere is 92 times that of Earth's, whereas the pressure at its surface is about 93 times that at Earth's—a pressure equivalent to that at a depth of nearly 1 km (5⁄8 mi) under Earth's oceans.
https://en.wikipedia.org/wiki/Venus
So the lack of a magnetic field to protect against the solar wind does not seem to resulted in Venus losing its atmosphere very rapidly.