The United States and four other Western nations opened negotiations with African representatives here today designed to iron out the remaining details of a U.N. plan for the independence of Namibia, a territory ruled by South Africa.

The informal talks are expected to run for a week or two, a spokesman for the Western nations said, and the Western negotiators hope that enough conditions can be agreed upon to enact a cease-fire in the territory, also known as Southwest Africa, in mid-August. That movement would allow the launching of the seven-month process leading to elections in March, under the U.N. timetable.

But the key to the agreement is not on the formal agenda. It is South Africa's demand for a link between the Namibia settlement and the withdrawal of Cuban and other Soviet Bloc troops from neighboring Angola, where the Southwest Africa People's Organization (SWAPO) liberation movement is based.

"If we get firm agreement on this question," said a senior South African diplomat here, "we can look forward to implementation of U.N. terms for the independence of Namibia in a matter of weeks."

SWAPO officials have protested the linkage as a delaying tactic, and the five Western nations--as a group--have not formally recognized it.

Western diplomats participating in the talks concede that "linkage is likely to come up."

The South Africans are not participating directly in the negotiations here but say they expect to be briefed on progress by American officials in Washington or Pretoria.

They suggested that in return for an Angolan pledge, South African aid to Jonas Savimbi's UNITA insurgent forces in Angola would ebb.

Western officials said they were close to a formula under which the elections would be either by constituencies (as South Africa would prefer) or by proportional representation (as SWAPO wishes), with the decision left to the South African administrator-general of the territory and the U.N. official who will monitor the process.

Agreement is also close on the details of the U.N. force to monitor the process, they said. Angola has agreed to U.N. monitoring of SWAPO bases on its territory. And South Africa has declared itself satisfied with U.N. impartiality after Western assurances and "because we have been impressed by the way Javier Perez de Cuellar has acted as secretary general," the South African diplomat said.

The five Western powers involved in the negotiations are Canada, Britain, West Germany, France and the United States, represented by Assistant Secretary of State for African Affairs Chester A. Crocker. The "front-line" African states invited to participate were Angola, Mozambique, Zimbabwe, Botswana, Tanzania, Zambia and Nigeria. SWAPO was represented by its chief U.N. observer, Theo-Ben Gurirab.