"Pedro, do you work in an office?"
Translation:Pedro, ¿trabajas en una oficina?
What you have written is 'Pedro works in an office', a statement in the third person. Duolingo has written a question asking Pedro directly whether he works in an office, so it's asking 'Do you work...? '¿Pedro, trabajas en una oficina? 'You work/Do you work? is '(tú) trabajas'.