“As spokesman of the German government, I am not going to judge who the British prime minister holds talks with,” Steffen Seibert told journalists in Berlin.
But he stressed that “it is clear that an EU member state cannot hold bilateral talks on free trade deals with non-EU states as long as it remains a member of the EU”.
Britain voted in June to leave the EU, but has not formally started the process to do so.
Berlin has repeatedly said that it and other EU members would not begin exit negotiations with London before it triggers the EU's Article 50 process to leave.
But May is under strong pressure at home to define what a post-Brexit world would look like, and one of her key challenges would be renegotiating Britain's access to world markets — an issue that Brussels currently undertakes on its behalf.
The British leader sought to use the occasion of the G20 to discuss free trade deals with non-EU states, meeting Australian Prime Minister Malcolm Turnbull to discuss a possible agreement.
India, Mexico, South Korea and Singapore had signalled they would “welcome” talks on removing trade barriers, she said.