The Boy in the Striped Pajamas
(2008)

The "farm" is a Nazi death camp which Bruno's father is running. Bruno befriends a boy in the camp, Shmuel, talking to him through the wire. He comes to realize that the camp is an unpleasant place, though neither boy realizes where the prisoners are vanishing to.

When Shmuel's father goes missing Bruno agrees to come back with a shovel and dig under the wire to look for him; Shmuel provides him with a prisoner's outfit to blend in.

As the family realize that Bruno is missing, the camp guards round a large group of inmates up and take them to the gas chamber. Bruno's father works out what is happening but is too late to stop it, and both Bruno and Shmuel are gassed to death with the other inmates.

Thanks Graham!