I think the issue is that when you iterate through a in the for loop, what you're iterating through is not each element in a, but each sub-array.
If you add print(len(a)), you'll see that you're getting 3 as the result, not the expected 30. So, when you iterate through a (i being the sub-array within a) and then test to see if the value is -1, what you're asking python to do is to see if an array of [0,-1,2,3,4,5,-1,-1,8,9] is equal to -1. An array can't be equal to an integer because it's an array not an integer. That error is telling you that when it says:
The truth value of an array with more than one element is ambiguous.
So, to answer your question, you can use if there, you you need to be comparing two like objects (ints to ints, strings to strings, etc.). You're trying to test if multiple values equal a single value and that's where python gets mad at you.
Your question is still a bit unclear as to what you want b to look like, but if you just want to return all the non -1 values in a in roughly the same shape as a, you could do a double for loop:
## Create blank output array
b = []
## First loop goes through the length of a, which will be 3, meaning we're iterating over each sub-array
for i in range(len(a)):
## Add a blank sub array to our output array
b.append([])
## Start a second loop that iterates through each element in the sub-array, keyed to the current index in our loop through 0-2
for x in a[i]: ## a[i] in the first loop is a[0], a[1] in the second run, etc.
if x != -1:
gg[i].append(x) ## Now append the value of x if it's not -1 to the sub-array we created at index i in b
print(b)
>>> [[0, 2, 3, 4, 5, 8, 9], [10, 12, 13, 14, 15, 18, 19], [20, 22, 23, 24, 25, 28, 29]]
There is also a much less ugly way to do this with list comprehension
b = [[y for y in x if y != -1] for x in a]
print(b)
>>> [[0, 2, 3, 4, 5, 8, 9], [10, 12, 13, 14, 15, 18, 19], [20, 22, 23, 24, 25, 28, 29]]