Lamal, one of the team's key players this season under new coach Hansi Flick, was ruled out before Sunday's game because of an ankle injury.
He was replaced by Fermín López and the team's attack - by far the best in the league with 40 goals scored in 13 matches - struggled in the Basque Country, unable to get a single attempt on target against Sociedad.
Sheraldo Becker scored a 33rd-minute winner to move Sociedad up to eighth place.
Barcelona have a six-point lead over second-place Real Madrid, who routed Osasuna 4-0 at home on Saturday with a hat-trick from Vinícius Júnior.
Madrid have a game in hand after their visit to Valencia was postponed because of the deadly floods in the Valencia region.
"We have to analyse what happened and keep working after the international break," Barcelona midfielder Pedri said. "We have been playing well and we are still in first place."
Barcelona had won seven in a row in all competitions since a 4-2 loss at Osasuna in the league in September. Their only other loss this season had been at Monaco in the Champions League.
Barcelona striker Robert Lewandowski, the league's leading scorer with 14 goals, had a first-half goal disallowed for offside.
Barcelona said Yamal sustained a "severe right ankle contusion" in last Wednesday's game against Red Star in the Champions League.
Flick said the club tested Yamal on Sunday to see if he could play "but it was not possible."
Julián Álvarez scored a second-half winner as Atletico Madrid moved back into third place with a 1-0 victory at Mallorca.
That left Atletico one point behind Madrid. They moved two points ahead of Villarreal, who defeated visiting Alaves 3-0 on Saturday.
Álvarez scored Atletico's winner in the 61st minute after Giuliano Simeone's assist. Simeone, the son of Atletico coach Diego Simeone, beat a defender to a long pass and set Álvarez for an easy strike from close range.
Goalkeeper Jan Oblak had another solid performance for Atletico, who earned their seventh clean sheet in the league this season, the most by any club.
Atletico were coming off a 2-1 midweek win at Paris Saint-Germain in the Champions League.
Marc Bartra scored a stoppage-time equaliser as seventh-place Real Betis salvaged a 2-2 home draw against 11th-place Celta Vigo.
Celta had moved ahead with Anastasios Douvikas' goal in the 82nd.
The visitors earlier took the lead through Javi Rodríguez in the 13th before Vitor Roque equalised for Betis in the 40th.
Midtable Girona won 1-0 at 17th-place Getafe with a first-half goal by Yangel Herrera.
Sixth-place Athletic Bilbao were held at second-to-last-place Valladolid, with the Basque Country club earning the equaliser with Gorka Guruzeta in stoppage time after the hosts had taken the lead with Raúl Moro in the 79th.