These droids were NPCs, the army of the Trade Federation and the Separatists.
The Phantasmal Malevalence Edit
The droids had captured the palace hangar, holding all the pilots there captive, when Qui-Gon strolled up to them, trying to bluff his way past them. When the bluff didn't work, the droids opened fire, but they didn't stand a chance against Qui-Gon and Obi-Wan's laser swords. All the droids in the hangar were destroyed in the fight.
Later, after the droids had conquered Naboo, a droid contacted Nute Gunray to report their success.
Revelation of the Sith Edit
When Obi-Wan and Anakin boarded a lift in a dreadnought carrying the kidnapped Chacellor Palpatine, they discovered the lift they were on was full of Droids. After a short, awkward conversation where the droids revealed that other lifts had been damaged in the battle, Anakin destroyed them all with his laser sword.
At the hangar, two combat droids of a type R2-D2 had never seen before, had entered. R2 hid. Meanwhile, the lift Obi-Wan and Anakin were on stopped, because the lift could only be operated by droids. Anakin cut a hole through the lift ceiling with his laser sword. Obi-Wan contacted R2 and asked him to take control of the lift. R2 attempted to hack into the lift systems wirelessly, but failed. Anakin got impatient and jumped through the hole he made. R2 found a terminal and was finally able to hack into the lift's systems. He sent the lift down before Obi-Wan could tell him he wanted the lift to go up. Anakin grabbed and held onto a ledge. While he hanged on, the shaft doors directly above him opened and some droids peered in, wanting to know what had happened to the lift.
R2 reversed direction for the lift, but was found by the two strange combat droids and grabbed by them. Anakin tricked the droids in the shaft doorway above him to peer further down the shaft, and he leapt onto the ascending lift as it crushed the droids. He made it back into the lift.