Primarily you need the Liberals to win the British parliamentary elections of 1895, and continuing Gladstone’s legacy of limiting the growth of the British Empire. That unfortunately would be difficult to arrange; the election wasn’t even close.
Alternatively, have the Colonial Office dispatch someone promptly from London to thoroughly investigate the Jameson Raid and bring charges of attempting insurrection in a friendly foreign state against all those involved, including Cecil Rhodes. Not having the Kaiser publicly congratulating Kruger after the raid fails is also critical.
Perhaps if some free press had had access to the republics during the second Boer War:
How would the British public, and Europe, have reacted to photographs of Women and Children dying by the thousand in British Concentration Camps?
Or if Kitchener’s verbal order to shoot Boer prisoners had reached public attention?
Or Baden-Powell’s starving of the “coloureds” during the siege of Mafeking?
Another option would be if the Boer state of Natalia had survived, giving the Boers direct access to sea trade.