Capturing errors in a transaction and rollback - declare not valid at this position
DECLAREs must be placed before all executable code in a BEGIN...END block.  `START TRANSACTION is 'executable'.

So...

DELIMITER //    
CREATE ...
BEGIN
    DECLARE _rollback DEFAULT 0;
    START TRANSACTION;
    ... -- other executables
    IF _rollback = 0
    THEN  COMMIT;
    ELSE  ROLLBACK;
    END IF;
END;
//
DELIMITER ;


You can also have nested BEGIN..END blocks.  But the declarations in your example should probably go at the beginning of the stored routine.  This is because BEGIN..END blocks provide "scoping" for variables such as _rollback.