Robb was born in Denver, Colorado to Janet and Dave Robb. She was named after her maternal great-grandmother, Anna Sophie, and her paternal grandmother, Anna Marie. She has a dog, Bella, and enjoys singing, snowboarding, rafting, dancing, and reading, especially fantasy and historical fiction. Robb competed in dance and gymnastics for four and a half years, but quit when she began acting; she was once home-schooled and now attends a private school in Colorado, having stated that she is quite serious about it and would like to attend college. Robb is a Christian and has said that she is really close with her family.
After starring in a commercial for McDonald's, Robb made her acting debut in 2004, appearing in a television special titled Samantha: An American Girl Holiday and in an episode of the television series Drake & Josh, "Number One Fan". She unsuccessfully auditioned for the roles of Emily Callaway in Hide and Seek and Rosemary Telesco in Little Manhattan. Robb appeared in two 2005 films; playing Opal, the lead character in Because of Winn-Dixie, a film which performed well at the domestic box office, grossing $32 million; and starring as Violet Beauregarde in director Tim Burton's remake of Charlie and the Chocolate Factory, which was a major box office success, raising Robb's popularity among pre-teen audiences. The same year, Robb was the face of Trad Clothing, helping to design and model a fashion line for girls. In 2006, she had a guest role on the cartoon show Danny Phantom, as the voice of Danielle "Dani" Fenton. Robb played Leslie Burke in Bridge to Terabithia, a fantasy drama which opened on February 16, 2007 and also starred Josh Hutcherson. She recorded a song, "Keep Your Mind Wide Open", for the film's soundtrack, and appeared in a music video for the song that aired on the Disney Channel. The song appeared on the Billboard Hot 100 at #90 during the week of March 1, 2007, being her first song to chart. Robb was a fan of the book that the film is based on before being cast in the role, specifying that the book "touched [her] in a way [she] hadn’t been touched by a book before". Robb's films include The Reaping, a thriller that opened April 5, 2007; Doubting Thomas, an adventure film; Sleepwalking, a drama; Jumper, an action film in which she plays the younger version of Rachel Bilson's character; and the 1960s-set drama Have Dreams, Will Travel (formerly A West Texas Children's Story), playing one of two children who are faced with neglectful parents. On the set of The Reaping, she wrote a short horror story called "Backseat Swamp".