In my oppinion it will be hard if not impossible to do this with just using rules. I would suggest using some code to loop through your repeating sections coming from your main or secondary datasource, compare the two namespace fields to each other and then dynamically generate new rows for a third repeating table filling it with either both name values if the namespaces are identical or only with nameA. Just search for "loop through repeating sections" and similar expressions in the forum and you should find what you need.
If you need more help let me know.