This one is likely "Retreat from Earth" (1938!) by Arthur C. Clarke. The point about termites defending the Earth from alien (in this case Martian) invasion is very close.
A Martian infiltrator is on Earth to gather intelligence for an invasion. He discovers that termites seem to be demonstrating intelligence and investigates. He detects an unknown sphere beneath a termite mound but is attacked first by gas and then by some kind of beam.
The Martian high command then sends a warship, but it is blown out of the sky and the Martians decide that maybe they'll invade Venus instead.
An alien force who consider Earth an easy target:
"Gentlemen," said the President of the Council gravely, "I am sorry to say that we have received a severe setback in our plans to colonize the third planet. As you all know, we have for many years been working on that planet unknown to its inhabitants, preparing for the day when we should
take over complete control. We anticipated no resistance, for the people of Three are at a very primitive level of development, and possess no weapons which could harm us.
The Martian attack is blown out of the sky:
Hours later the tremendous mass of the flagship of the Martian fleet dropped thunderously through the outer reaches of Earth's atmosphere towards the far-off waters of the Pacific. She fell in the heart of a tornado, for her captain was taking no chances and the winds of the stratosphere were being annihilated by her flaming ray screens.
But on a tiny island far over the eastern horizon, the termites had been preparing for the attack they knew must come, and strange, fragile mechanisms had been erected by myriad blind and toiling insects. The great Martian warship was two hundred miles away when her captain located the island in his televisor. His finger reached towards the button which would start the enormous ray generators, but swift as he was the almost instant acting relays of the termite mind were far swifter. Though, in any case, the outcome would have been the same.
The great spherical screens did not flare even once as the enemy struck home. Their slim rapier of pure heat was driven by only a score of horsepower, while behind the shields of the warship were a thousand million. But the feeble heat beam of the termites never passed through those screens – it reached out through hyperspace to gnaw at the very vitals of the ship. The Martians could not check an enemy who struck from within their defences, an enemy to whom a sphere was no more a barrier than a hollow ring.
The termite rulers, those alien beings from outer space, had kept their agreement with the old lords of Earth, and had saved man from the danger his ancestors had long ago foreseen.
It appears the only anthology the story appears in in the time frame you give is The Best of Arthur C. Clarke: 1937-1971 or the first half of its 2-volume republishing The Best of Arthur C. Clarke: 1937-1955.